﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;

namespace Common
{
    public static class Tools
    {
        public static string ApiPath = ConfigurationManager.AppSettings["ApiServer"].ToString();
        public static string ImgPath = ConfigurationManager.AppSettings["ImgServer"].ToString();
        public static string HeadImg = ImgPath + "Content/Image/HeadImg/";
        public static string TemplateImg = ImgPath + "Content/Image/TemplateImg/";
        public static string CommentImg = ImgPath + "Content/Image/CommentImg/";
        public static string StrategImg = ImgPath + "Content/Image/StrategImg/";
        public static string BasicInformationImg = ImgPath + "Content/Image/BasicInformationImg/";
        public static string UserHeadImg = ImgPath + "Content/Image/UserHeadImg/";


        public static string CountAge(DateTime date)
        {
            var datetime = DateTime.Now;
            int oldyear = date.Year;
            int year = DateTime.Now.Year;
            int differ = year - oldyear;
            if (date.AddYears(differ)>= datetime)
            {
                return differ + "岁";
            }
            return differ - 1 + "岁";
        }
    }
}
